//
//  SpriteView.h
//  PhotoMagician
//
//  Created by yang weiwei on 12-7-9.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>

@class SpriteContainerView;

@interface SpriteView : UIView
{
	UIImageView*	imageView;
	CGPoint			touchOffset;
	UIImageView*	rotateImageView;
	UIImageView*	cancelImageView;
	bool			isTransforming;
	bool			isEditting;
	
	CGAffineTransform	startTransform;
}
@property(nonatomic) bool			isEditting;
@property(nonatomic, strong) NSObject* userObject;

- (UIImage*)image;
- (void)setImage:(UIImage*)image;
- (void)setView:(UIView*)aView;
- (UIView*)getViewWithClass:(Class)cls;

@end



typedef void(^SpriteContainerViewEventBlock)(SpriteContainerView* container, SpriteView* sprite);
typedef BOOL(^SpriteContainerViewBoolBlock)(SpriteContainerView* container, SpriteView* sprite);

@interface SpriteContainerView : UIView
{
	
}
@property(nonatomic, copy) SpriteContainerViewEventBlock spriteSelected;
@property(nonatomic, copy) SpriteContainerViewEventBlock spriteUnselected;
@property(nonatomic, copy) SpriteContainerViewEventBlock spriteDelete;
@property(nonatomic, copy) SpriteContainerViewBoolBlock shouldUnselectSprite;

- (void)unselectAllSprite;
- (void)addSprite:(SpriteView*)view;
- (void)selectTopSprite:(bool)select;
- (SpriteView*)getTopSprite;
- (void)spriteEditStateChanged:(SpriteView*)sprite;

@end


CGRect rectScale(CGRect rc, float xs, float ys);
